import React from 'react'
import { withRouter } from 'react-router-dom'
import { NavBar } from 'antd-mobile'
import PropTypes from 'prop-types'
import './index.sass'
function NavHeader({ children, history, onLeftClick ,rightContent,className}) {
  NavHeader.propTypes = {
    children: PropTypes.string.isRequired,
    onLeftClick: PropTypes.func
  }
  const defaultLeftClick = () => history.go(-1)
  return (
    <NavBar className={className || 'nav-bar'}
      mode="light"
      icon={<i className="iconfont icon-back" />}
      onLeftClick={onLeftClick || defaultLeftClick}
      rightContent={rightContent}
    >{children}</NavBar>
  )
}
export default withRouter(NavHeader)
